package msg_list

import "encoding/binary"

type XNCCHeader struct {
    ProtoId uint32
    BodyLen int32
}

func (h *XNCCHeader) Len() int32 {
    return 8
}

func (h *XNCCHeader) Encode(b []byte) {
    binary.BigEndian.PutUint32(b[0:4], h.ProtoId)
    length := uint32(h.BodyLen)
    binary.BigEndian.PutUint32(b[4:8], length)

}

func (h *XNCCHeader) Decode(b []byte) {
    h.ProtoId = binary.BigEndian.Uint32(b[0:4])
    h.BodyLen = int32(binary.BigEndian.Uint32(b[4:8]))
}
